<script>
import { QTd } from 'quasar';
import { slot } from './utils/slot.js';

export default {
  name: 'CcTd',
  extends: QTd,
  mounted() {
  },

  render(h) {
    const on = this.qListeners;
    let col = {label:''}

    if (this.props === undefined) {
      return h('td', {
        on,
        dataLabel: col.label,
        class: this.classes,
      }, slot(this, 'default'));
    }

    const name = this.$vnode.key;

    col = this.props.colsMap !== undefined && name
      ? this.props.colsMap[name]
      : this.props.col;

    if (col === undefined) { return; }

    const { row } = this.props;

    return h('td', {
      on,
      style: col.__tdStyle(row),
      attrs: {
        'data-label': col.label,
      },
      class: this.classes + col.__tdClass(row),
    }, slot(this, 'default'));
  },
};

</script>
<style lang="stylus">
</style>
